<%@ page contentType="text/html; charset=utf-8" language="java"%>
<%@ include file="/common/index.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>手游平台管理系统_运营平台中心</title>
<link type="text/css" rel="stylesheet" href="<%=basePath %>/css/index.css" />
<SCRIPT type="text/javascript" src="<%=basePath %>/js/jquery-1.7.1.min.js" charset="utf-8"></SCRIPT>
<script language="javascript"  src="<%=basePath %>/js/lightbox/jquery.lightbox_me.js"></script>
<SCRIPT type="text/javascript" src="<%=basePath %>/js/validate.js" charset="utf-8"></SCRIPT>
<base target="_self">
<script language="javascript">
<!--
	$(function(){
		$(".loginBtn1").click(function(){
			userLogin();
		});
		
		$(".registerBtn1").click(function(){
			toRegister();
		});
		
	});
	
	 function userLogin()
	 {
	       g("form").submit();
	 }
	 
	 function toRegister(){
		$("#SHOW_DIV_1").lightbox_me({
			 centered: true
			,modalCSS:{}
			,onClose:function(){clearFormValue('register-Form');}
		});
	}
	
	function register(){
		var url = "<%=basePath %>/manager/user/insert.shtml";
		var param = $("#register-Form").serialize();
		var v1 = document.getElementById("vo.devname1").value;
		var v2 = document.getElementById("vo.devpasswd1").value;
		if(v2=='' || v2.length<6){
				alert('密码长度至少为6位。');
				return false;
		}
		
		var v3 = document.getElementById("vo.phonenum1").value;
		if(v3!=''){
			if(! ((/^1[3|4|5|8][0-9]\d{4,8}$/.test(v3) ))){
				alert('输入的手机号格式有误。');
				return false;
			}
		}
		
		$.post(url 
			,param 
				,function(rs) {
					if(rs.code==0){
						// 注册成功直接登录
						document.getElementById("vo.devname").value=v1;
						document.getElementById("vo.devpasswd").value=v2;
						userLogin();
					}else if(rs.code==-1){
						alert('该帐号为空');	
					}else if(rs.code==-2){
						alert('帐号只能以字母开头');	
					}else if(rs.code==-3){
						alert('帐号长度为6-20个字符');	
					}else if(rs.code==-4){
						alert('帐号由数字,字母或下划线组成,并只能以字母开头,字母和数字结尾');	
					}else if(rs.code==-5){
						alert('该帐号已存在');	
					}else{
						alert('操作失败');
					}
				}
		   ,'json');
		clearFormValue('register-Form');
	}
	 
	function clearFormValue(fId){
		$('#'+fId)[0].reset();
		$(".para_li").remove();
	} 
	
	
-->
</script>
</head>
<body>
	<iframe frameborder="0" allowtransparency="true" src="<%=basePath %>/common/header.jsp" class="header_iframe"></iframe>

    <div class="main">
 		<s:form id="form" action="/manager/user/login.shtml" theme="simple" >  
	        <ul class="login_ul">
	        	<li>
	            	用户：<input type="text"   value="administrator"  name="vo.devname" id="vo.devname" maxlength= "20"/>
	            </li>
	            <li>
	            	密码：<input type="password"  value="123456"   name="vo.devpasswd" id="vo.devpasswd"  maxlength= "20" />
	            </li>
	            <li>
	            	<span class="default_btn_1 loginBtn1">登录</span> &nbsp;&nbsp;
	            	<!-- 
	            	 <span class="default_btn_1 registerBtn1">注册</span>
	            	  -->
	            </li>
	        </ul>      
	      </s:form>
 		<div class="login_info">copyright ©2005 上海巨人网络科技有限公司</div>
    </div>
    
    
    <div id="SHOW_DIV_1" style="height:600px;display:none;overflow:auto;">
        <div class="show_main">
            <div class="title">注册成为开发者</div>
            <div class="content">
              <s:form action="/manager/user/insert.shtml" id="register-Form" name="register-Form"  theme="simple">  
                <ul>
                    <li>
                        <span class="spanTxt">开发者账号：</span>
                        <input type="text" class="inputText_2" name="vo.devname" id="vo.devname1"  maxlength="20"  />
                    </li>
                    <li>
                     	<span class="spanTxt">账号密码：</span>
                        <input type="password" class="inputText_2" name="vo.devpasswd" id="vo.devpasswd1"  maxlength="20"  />
                    </li>
                    <li>
                        <span class="spanTxt">手机号：</span>
                        <input type="text" class="inputText_2" name="vo.phonenum" id="vo.phonenum1"   maxlength="15"  />
                    </li>
                </ul>
      			</s:form>
            </div>
            <div class="bottom">
                <span class="default_btn_1" id="insert-update-but"  onclick="register();"   >确定</span>&nbsp;&nbsp;&nbsp;&nbsp;
                <span class="default_btn_1 close">取消</span>
            </div>
        </div>
	</div>
    
</body>
</html>
